import { CoolController, BaseController } from '@cool-midway/core';
import { UserInfoEntity } from '../../entity/info';
import { UserInfoService } from '../../service/info';
import { Get, Inject } from '@midwayjs/core';

/**
 * 用户信息
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: UserInfoEntity,
  service: UserInfoService,
  pageQueryOp: {
    fieldEq: ['status', 'gender', 'loginType'],
    keyWordLikeFields: ['nickName', 'phone'],
  },
})
export class AdminUserInfoController extends BaseController {
  @Inject()
  userInfoService: UserInfoService;
  /**
   * 获得日志保存时间
   */
  @Get('/sendEmail', { summary: '发送邮件' })
  public async sendEmail() {
    return this.ok(await this.userInfoService.sendEmail());
  }
}
